package com.jyz.support.utils;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.jyz.refinery.sample.service.ISampleManager;

public class ServiceUtil {
	
	private static final String CONTEXT_XML_FILE_BS = "remoting-servlet.xml";

	private static ApplicationContext context = null;
	
	static {
		try {
			context = new ClassPathXmlApplicationContext(CONTEXT_XML_FILE_BS);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	private static ISampleManager sampleManager;

	public static ISampleManager getSampleManager() {
		if (sampleManager == null)
			sampleManager = (ISampleManager) context.getBean(ISampleManager.DIRECT_INVOKE);
		return sampleManager;
	}
	
}
